package me.kany.project.maven.cert;

import java.io.File;
import java.io.FilenameFilter;
import java.util.ArrayList;
import java.util.List;

public class FileUtil {
	private static String path = "D:/Program Files/Java";

	public static List<String> readList() {
		File file = new File(path);
		MyFilter myFilter = new MyFilter();
		String fullPath = "";
		List<String> filePath = new ArrayList<String>();
		if(file.exists() && file.isDirectory()){
			String[] files = file.list(myFilter);
			for (String string : files) {
				if(string.startsWith("jdk")){
					fullPath = path + "/" + string + "/jre/lib/security/";
					filePath.add(fullPath);
				}else if(string.startsWith("jre")){
					fullPath = path + "/" + string + "/lib/security/";
					filePath.add(fullPath);
				}
			}
		}
		return filePath;
	}

	static class MyFilter implements FilenameFilter {
		public boolean accept(File dir, String name) {
			return name.startsWith("jdk") || name.startsWith("jre");
		}
	}
}
